// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'

// 配置axios（重点修正）
axios.defaults.baseURL = 'http://localhost:8081'  // 必须与后端端口一致
axios.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded'
// 禁用JSON转换（避免参数被转为JSON格式，后端无法接收）
axios.defaults.transformRequest = []

// 全局注册
const app = createApp(App)
app.use(router)
app.use(ElementPlus)
app.config.globalProperties.$axios = axios
app.mount('#app')